﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace DTcms.Web
{
    public partial class zhengze : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            BLL.users bll = new BLL.users();
            string s = TextBox1.Text;
            Regex reg = new Regex("\"targetId\":\"([0-9]+)\"", RegexOptions.IgnoreCase);
            MatchCollection mac = reg.Matches(s);
            foreach (Match m in mac)
            {
                string str = m.Groups[0].Value;
                int _target_id = int.Parse(m.Groups[1].ToString());
                Model.users model = bll.GetModel(_target_id);
                if (model != null)
                {
                    string _username = model.user_name;
                    string _avatar = model.avatar;
                    s = s.Replace(str, str + ",\"userName\":\"" + _username + "\",\"userAvatar\":\"" + _avatar + "\"");
                }
            }
            TextBox2.Text = s.ToString();
        }
    }
}